package cn.dengta.webapp.trade.form.query;

import cn.dengta.webapp.base.form.BaseForm;
import cn.dengta.webapp.trade.entity.UserCoinLog;
import cn.dengta.webapp.user.entity.User;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.X;

@Setter
@Getter
public class UserCoinLogQuery extends BaseForm<UserCoinLog> {

	/** 用户ID */
	protected Long userId;
	/** 用户昵称 */
	protected String userNickname;
	/** 资金流向：1=收入；0=不变；-1=支出 */
	protected Integer flow;
	/** 交易方：1=from；2=to */
	protected Integer side;
	/** 业务类型 */
	protected String tradeType;
	/** 订单号 */
	protected String orderNO;
	/** 处理状态 */
	protected Integer handleStatus;
	/** 处理状态 */
	@Setter(AccessLevel.NONE)
	protected User user;

	public void setUserId(Long userId) {
		this.userId = userId;
		user().setId(userId);
	}

	public void setUserNickname(String userNickname) {
		this.userNickname = userNickname;
		user().setNickname(userNickname);
	}

	private User user() {
		return user = X.getElse(user, User::new);
	}

}
